<?php echo $this->Form->create('Paginate', array('id' => 'paginate', 'url' => $this->request->here(false), 'type' => 'post', 'inputDefaults' => array('label' => false))); ?>           				
<div id="content-header">
<h1>Role Management</h1>
</div>
<div class="container-fluid">
<div class="row-fluid">
	<div class="span12">	
                <?php
            echo $this->element('toolbar');
            ?>	
            							
		<div class="widget-box widget-content-no-padding">
            <!--For manage node normal-->
                <div class="widget-content widget-content-two">
                
                <table class="table table-bordered data-table table-striped wd-hover-btn">
					<thead>
						<tr>
                            <th><?php echo  __d('system', 'Id'); ?>      </th>
                            <th> <?php echo  __d('system', 'Name'); ?></th>
                            <th> <?php echo  __d('system', 'Description'); ?></th>
                            <th> <?php echo  __d('system', 'Created'); ?></th>
                            <th class="wd-fix-width-1"><?php echo  __d('system', 'Action'); ?></th>
						</tr>
					</thead>
					<tbody>
                        <?php $defaultLanguage = Router::defaultLanguage();
                            $_queries = array('continue' => $this->request->here(false));?>                    
                   <?php foreach ($roles as $role) : ?>
						<tr>
                		                
                        <?php if (isset($_displayFields['id'])): ?>       
  	                         <td> <?php echo $role['Role']['id']; ?></td>
                           <?php endif; ?>
                        <?php if (isset($_displayFields['name'])): ?>       
  	                         <td>
                           <?php echo  $role['Role']['name']; ?>
                           </td>
                               <?php endif; ?>
                        <?php if (isset($_displayFields['description'])): ?>       
  	                         <td>
                          <?php echo $role['Role']['description']; ?>
                           </td>
                               <?php endif; ?>
                        <?php if (isset($_displayFields['created'])): ?>       
  	                         <td>
                       <?php echo date("d-m-Y",$role['Role']['created']); ?>
                           </td>
                               <?php endif; ?>                               
   
                                                    
								<td>
							<ul class="wd-link-control">
							<li><a href="<?php echo $this->Html->url(array('plugin'=>'user','controller' => 'roles', 'action' => 'edit', $role['Role']['id'], '?' => $_queries));?>" class="btn btn-mini"><i class="icon-edit"></i> Edit</a></li>
                                 <?php    if (!in_array($role['Role']['id'], $roleMap)) { ?>
							<li><a href="#<?php echo $role['Role']['id']?>" data-toggle="modal" class="btn btn-mini"><i class="icon-remove"></i> Delete</a></li>
                                <?php  }?>
    					   </ul>
							</td>
						</tr>
                                                      
           <?php endforeach?>   
              <?php foreach ($roles as $role) : ?>
       				<div id="<?php echo $role['Role']['id']?>" class="modal hide">
					<div class="modal-header">
						<button data-dismiss="modal" class="close" type="button">×</button>
						<h3>Alert modal</h3>
					</div>
					<div class="modal-body">
						<p>Are you sure delete “<?php echo $role['Role']['name']?>”?</p>
					</div>
					<div class="modal-footer">
						<a data-dismiss="modal" class="btn" href="#">Cancel</a>
                        <?php echo $this->Html->link('Delete', array('plugin'=>'user','controller' => 'roles','action' => 'delete', '?' => array_merge($_queries, array('keys' => array($role['Role']['id'])))), array('title' => false, 'class' => 'btn btn-danger','data-dismiss='=>'modal')); ?>                        
					</div>
				</div>    
                <?php endforeach?>                  
					</tbody>
				</table>							
			</div>
		</div>
	</div>	
</div>
<?php         
echo $this->Form->hidden('task', array('id' => 'task', 'value' => ''));
echo $this->Form->end();
?>